﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AuctionHelper.Entity;

namespace AuctionHelper.Business
{
    /// <summary>
    /// 脚本业务类
    /// </summary>
    public class ScriptBLL
    {
        /// <summary>
        /// 获取脚本集合
        /// </summary>
        /// <returns></returns>
        public static List<Script> GetScripts()
        {
            return new List<Script>();
        }

        public static void CreateScript()
        {

        }

        /// <summary>
        /// 执行脚本
        /// </summary>
        /// <param name="script"></param>
        public static void RunScript(Script script)
        {
            var auctionRemainingPositions=50;//TODO 获取Auction剩余仓库位
            var auction = script.UIList.Single(u => u.UIName == "Auction") as Auction;
            AuctionBLL.SetSearchFilter(auction);
            AuctionBLL.Search(auction);
            AuctionBLL.SearchReSort(auction);

            do
            {
                var result = AuctionBLL.GetSearchResult(auction);
                
            }
            while (auctionRemainingPositions > 0);
        }

        /// <summary>
        /// 改变脚本执行顺序
        /// </summary>
        /// <param name="sourceSort">源顺序</param>
        /// <param name="targetSort">目标顺序</param>
        public static void ChangeScriptSort(int sourceSort, int targetSort)
        {

        }
    }
}
